<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改预算科目')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-yskm-edit" th:object="${tGgYskm}">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">预算科目编码：</label>
                <div class="col-sm-8">
                    <input name="yskm" th:field="*{yskm}" class="form-control" type="text" readonly required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">预算科目名称：</label>
                <div class="col-sm-8">
                    <input name="yskmmc" th:field="*{yskmmc}" class="form-control" type="text" required>
                </div>
            </div>
           <div class="form-group">    
                <label class="col-sm-3 control-label">启用时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="qssj" id="qssj" th:value="${#dates.format(tGgYskm.qssj, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">终止时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input name="zzsj" id="zzsj" th:value="${#dates.format(tGgYskm.zzsj, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">上级预算科目编码：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <input id="treeId" name="sjyskm" type="hidden" th:field="*{sjyskm}" />
                        <input class="form-control" type="text" onclick="selectYskmTree()" id="treeName" readonly="true" th:field="*{parentName}">
                        <span class="input-group-addon"><i class="fa fa-search"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">级次：</label>
                <div class="col-sm-8">
                    <input name="jc" th:field="*{jc}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">是否末级：</label>
                <div class="col-sm-8">
	                <select name="sfmj" class="form-control">
					     <option value="0" th:selected="*{sfmj}==0">否</option>
						 <option value="1" th:selected="*{sfmj}==1">是</option>
					 </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">预算科目类别：</label>
                <div class="col-sm-8"> 
                      <select name="kmlb" class="form-control">
					    <option value="0" th:selected="*{kmlb}==0">收入分类</option>
						<option value="1" th:selected="*{kmlb}==1">支出功能分类</option>
						<option value="2" th:selected="*{kmlb}==2">支出经济分类</option>
					</select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <input name="bz" th:field="*{bz}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">启用标志：</label>
                <div class="col-sm-8">
                     <select name="qybz" class="form-control">
					    <option value="0" th:selected="*{qybz}==0">启用</option>
						<option value="1" th:selected="*{qybz}==1">停用</option>
					</select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">有效标志：</label>
                <div class="col-sm-8">
                      <select name="yxbz" class="form-control">
					    <option value="0" th:selected="*{yxbz}==0">有效</option>
						<option value="1" th:selected="*{yxbz}==1">无效</option>
					</select>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/yskm";
        $("#form-yskm-edit").validate({
            focusCleanup: true
        });
        
        $("#qssj").datetimepicker({
		      format: 'yyyy-mm-dd',
			  language: 'zh-CN',
			  minView: "month",
			  todayBtn: false,
			  autoclose: true
				});
        
        $("#zzsj").datetimepicker({
		      format: 'yyyy-mm-dd',
			  language: 'zh-CN',
			  minView: "month",
			  todayBtn: false,
			  autoclose: true
				});
        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-yskm-edit').serialize());
            }
        }

        $("input[name='zzsj']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        /*预算科目-新增-选择父部门树*/
        function selectYskmTree() {
            var options = {
                title: '预算科目选择',
                width: "380",
                url: prefix + "/selectYskmTree/" + $("#treeId").val(),
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }

        function doSubmit(index, layero){
            var body = layer.getChildFrame('body', index);
               $("#treeId").val(body.find('#treeId').val());
               $("#treeName").val(body.find('#treeName').val());
               layer.close(index);
        }
    </script>
</body>
</html>